#ifndef MID_KEY_H
#define MID_KEY_H

#ifdef	EXTR
#undef	EXTR                        	// undefine "EXTR"                                                               
#endif
						                                                                                         
#ifdef	MID_KEY_C			    		// redefine "EXTR",make sure EXTR defined according to the constant of "main".   
#define EXTR   
#else						                                                                                         
#define EXTR	extern                                                                                               
#endif 

#define	PRESS_KEY_EVENT_NUM			(10)
#define RELEAE_KEY_EVENT_NUM		(8)

#define	Key_TIMER_RATE				(10)	//  单位 : 1ms

#define KEY_60MS            		(60/Key_TIMER_RATE)
#define KEY_100MS           		(100/Key_TIMER_RATE)
#define KEY_200MS           		(200/Key_TIMER_RATE)
#define KEY_300MS           		(300/Key_TIMER_RATE)
#define KEY_500MS           		(500/Key_TIMER_RATE)
#define KEY_1S              		(1000/Key_TIMER_RATE)
#define KEY_2S              		(2000/Key_TIMER_RATE)
#define KEY_3S              		(3000/Key_TIMER_RATE)
#define KEY_4S              		(4000/Key_TIMER_RATE)
#define KEY_5S              		(5000/Key_TIMER_RATE)
#define KEY_10S             		(10000/Key_TIMER_RATE)

typedef void (*pKeyEventFunc)(void);

extern void KeyProc(unsigned short KeyVal);              // 按键事件处理主函数
extern unsigned char KeyPressRegist(unsigned short KeyVal,unsigned short TrigTime, unsigned short RepeatTime, pKeyEventFunc pFunc);
extern unsigned char KeyReleaseRegist(unsigned short KeyVal,unsigned char MinTime, unsigned char MaxTime, pKeyEventFunc pFunc);


#endif

